package com.sangmo.fts.training.model;

import com.sangmo.boot.framework.data.entity.general.LongEntity2;
import com.sangmo.boot.framework.data.json.meta.ExtView;
import com.sangmo.boot.framework.data.json.meta.Many;
import com.sangmo.boot.framework.data.json.meta.One;
import com.sangmo.boot.framework.plugin.dataview.def.meta.DataField;
import com.sangmo.boot.framework.plugin.dataview.def.meta.DataView;
import com.sangmo.fts.common.IConstants;
import com.sangmo.fts.user.model.User;

import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import java.util.Date;

@Entity
@Table(name = "team")
@DataView
@ExtView
public class Team extends LongEntity2 {

    @One(value = "creator", target = User.class,src = "createdBy",fieldset = {"id","name"})

    @Many(value = "teammates", target = Teammate.class, src = "id",ref = "teamId", batch = true)

    @DataField(value = IConstants.DATA_TYPE.STRING_100,required = true, index = true)
    private String name;

    @DataField(value = IConstants.TEAM_DATA_TYPE.TEAM_BUSINESS_TYPE, required = true, index = true)
    private String businessType;

    @DataField(value = IConstants.DATA_TYPE.LONG, required = true, index = true)
    private Long clazzId;

    @DataField(index = true)
    private Long examinationId;

    @DataField(value = IConstants.DATA_TYPE.DATE_FUTURE, index = true)
    private Date endTime;

    private String description;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getBusinessType() {
        return businessType;
    }

    public void setBusinessType(String businessType) {
        this.businessType = businessType;
    }

    public Long getClazzId() {
        return clazzId;
    }

    public void setClazzId(Long clazzId) {
        this.clazzId = clazzId;
    }

    public Long getExaminationId() {
        return examinationId;
    }

    public void setExaminationId(Long examinationId) {
        this.examinationId = examinationId;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public interface BusinessTypes {
        //存货质押融资
        String INVENTORY_FINANCING = "INVENTORY_FINANCING"; //IF
        //保兑仓融资
        String CONFIRMING_STORAGE_FINANCING = "CONFIRMING_STORAGE_FINANCING";//CSF
        //应收账款质押融资
        String RECEIVABLE_PLEDGE_FINANCING = "RECEIVABLE_PLEDGE_FINANCING";//RPF
        //保理融资(有追索权明保理)
        String FACTORING_FINANCING = "FACTORING_FINANCING";//FF
    }
}
